home *** CD-ROM | disk | FTP | other *** search
/ No Fragments Archive 12: Textmags & Docs / nf_archive_12.iso / MAGS / SOURCES / ATARI_SRC.ZIP / atari source / AHDI / TTDRIVER / OS.DB < prev    next >
Encoding:
Text File  |  2001-02-09  |  4.3 KB  |  93 lines

  1. # loading this file sets up the procedures "dbos" and "_dbos" and "unos"
  2. #
  3. # execute dbos to set up GEMDOS debugging using breakpoint slots 0 and 1.
  4. # execute unos to remove GEMDOS debugging
  5. #
  6. # _dbos is executed by dbos.  Its argument, argsp, is the sp at which
  7. # to start looking for arguments.  The program RAMTRAP1.PRG can be run
  8. # to install a RAM hook at the entrance to and exit from trap 1, in
  9. # such a way that the correct argsp is in a0 at the place where dbos
  10. # sets its breakpoint.  For PEXEC calls, it's just on the entrance
  11. # to trap 1.
  12. #
  13.  
  14. global dbos_ret
  15.  
  16. procedure _dbos argsp
  17.   local fc warg1 larg1
  18.  
  19.   x dbos_ret 1
  20.   xfc (wpeek `argsp)
  21.   xargsp (+ `argsp 2)
  22.   xwarg1 (wpeek `argsp)
  23.   xlarg1 (lpeek `argsp)
  24.  
  25.   #nothing for 1-b or 10-13 (I/O functions)
  26.   if (|| (&& (< `fc 14) (> `fc f)) (&& (< `fc c) (> `fc 0))) \
  27.     "echo -n;xdbos_ret 0; goto end"
  28.   if (== `fc 0) "echo -n Pterm0 ; goto end"
  29.   if (== `fc e) "print -n Dsetdrv `warg1 ; goto end"
  30.   if (== `fc 19) "echo -n Dgetdrv ; goto end"
  31.   if (== `fc 1a) "print -n Fsetdta `larg1 ; goto end"
  32.   if (== `fc 20) "print -n Super `larg1 ; goto end"
  33.   if (== `fc 2a) "echo -n Tgetdate ; goto end"
  34.   if (== `fc 2b) "print -n Tsetdate `warg1 ; goto end"
  35.   if (== `fc 2c) "echo -n Tgettime ; goto end"
  36.   if (== `fc 2d) "print -n Tsettime `warg1 ; goto end"
  37.   if (== `fc 2f) "echo -n Fgetdta ; goto end"
  38.   if (== `fc 30) "echo -n Sversion ; goto end"
  39.   if (== `fc 31) "print -n Ptermres `larg1 (wpeek (+ `argsp 4)) ; goto end"
  40.   if (== `fc 36) "print -n Dfree `larg1 (wpeek (+ `argsp 4)) ; goto end"
  41.   if (== `fc 39) "print -n Dcreate -s `larg1 ; goto end"
  42.   if (== `fc 3a) "print -n Ddelete -s `larg1 ; goto end"
  43.   if (== `fc 3b) "print -n Dsetpath -s `larg1 ; goto end"
  44.   if (== `fc 3c) "print -n Fcreate -s `larg1 -x (wpeek (+ `argsp 4)) ; goto end"
  45.   if (== `fc 3d) "print -n Fopen -s `larg1 -x (wpeek (+ `argsp 4)) ; goto end"
  46.   if (== `fc 3e) "print -n Fclose `warg1 ; goto end"
  47.   if (== `fc 3f) "print -n Fread `warg1 (lpeek (+ `argsp 2)) (lpeek (+ `argsp 6)) ; goto end"
  48.   if (== `fc 40) "print -n Fwrite `warg1 (lpeek (+ `argsp 2)) (lpeek (+ `argsp 6)) ; goto end"
  49.   if (== `fc 41) "print -n Fdelete -s `larg1 ; goto end"
  50.   if (== `fc 42) "print -n Fseek offset: `larg1 handle: (wpeek (+ `argsp 4)) mode: (wpeek (+ `argsp 6)) ; goto end"
  51.   if (== `fc 43) "print -n Fattrib -s `larg1 -x wflag: (wpeek (+ `argsp 4)) attr: (wpeek (+ `argsp 6)) ; goto end"
  52.   if (== `fc 44) "print -n NMalloc amt: `larg1 mode: (wpeek (+ `argsp 4));goto end"
  53.   if (== `fc 45) "print -n Fdup `warg1 ; goto end"
  54.   if (== `fc 46) "print -n Fforce `warg1 to the same as (wpeek (+ `argsp 2)) ; goto end"
  55.   if (== `fc 47) "print -n Dgetpath `larg1 (wpeek (+ `argsp 2)) ; goto end"
  56.   if (== `fc 48) "print -n Malloc `larg1 ; goto end"
  57.   if (== `fc 49) "print -n Mfree `larg1 ; goto end"
  58.   if (== `fc 4a) "print -n Mshrink 0 (lpeek (+ `argsp 2)) (lpeek (+ `argsp 6)) ; goto end"
  59.   if (== `fc 4b) "print Pexec mode: `warg1 (lpeek (+ `argsp 2)) (lpeek (+ `argsp 6)) (lpeek (+ `argsp a)) ; goto end"
  60.   if (== `fc 4c) "print -n Pterm `warg1 ; goto end"
  61.   if (== `fc 4e) "print -n Fsfirst -s `larg1 -x (wpeek (+ `argsp 4)) ; goto end"
  62.   if (== `fc 4f) "echo -n Fsnext ; goto end"
  63.   if (== `fc 56) "print -n Frename -s (lpeek (+ `argsp 2)) (lpeek (+ `argsp 6)) ; goto end"
  64.   if (== `fc 57) "print -n Fdatime buf: `larg1 handle: (wpeek (+ `argsp 4)) wflag: (wpeek (+ `argsp 6))"
  65. #:end
  66. .
  67.  
  68. procedure ramtrap1
  69.   local ptr
  70.   x ptr (- (lpeek 84) $c)
  71.   if (! (= (lpeek `ptr) 524d5431)) abort ramtrap1.prg not installed.
  72.   b#0 (lpeek (+ `ptr 4))
  73.   b#1 (lpeek (+ `ptr 8))
  74.   alias br0 "_dbos `a0;defer g"
  75.   alias br1 "if `dbos_ret print returns `d0;defer g"
  76.   echo dbos installed
  77. .
  78.  
  79. alias ramgemdos "b#0 .osif;fw._gouser[40] 4e73;b#1 $; \
  80.     alias br0 '_dbos (lpeek (+ `sp 4));defer g' ;\
  81.     alias br1 'if `dbos_ret print returns `d0;defer g'"
  82.  
  83. alias alcgemdos "b#0 (+ .gemdos 6);b#1 (+ .gemdos 8); \
  84.     alias br0 '_dbos `sp;defer g' ; \
  85.     alias br1 'if `dbos_ret print returns `d0;defer g'"
  86.  
  87. alias nogemdos "nb #0 ; nb #1 ; unalias br0 br1"
  88.  
  89. echo GEMDOS DEBUGGING LOADED
  90. echo say ramgemdos for ram-loaded TOS or GEMDOS, or alcgemdos for 
  91. echo Alcyon-style (_trap1 procedure), ramtrap1 if you ran ramtrap1.prg,
  92. echo and nogemdos to get rid of OS debugging.
  93.